package com.longyiqun.cm.controller.cases;

import com.longyiqun.cm.PageUtil;
import com.longyiqun.cm.domain.TestCaseEntity;
import com.longyiqun.cm.service.CasesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.websocket.server.PathParam;

@Controller
@RequestMapping("/case")
public class CasesControllerImpl implements CasesController {

    @Autowired
    CasesService casesService;

    @Autowired
    PageUtil pageUtil;

    @Override
    @RequestMapping("/allCases")
    public String list(Model model) {
        return "ApiTest/casesList";
    }

    @Override
    @RequestMapping("/detail")
    public String detail(@PathParam("caseID") String caseID, Model model) {
        TestCaseEntity tc = casesService.findOne(caseID);
        model.addAttribute("caseID", caseID);
        model.addAttribute("tc", tc);
        return "ApiTest/caseDetail";
    }

    @Override
    @RequestMapping("/add")
    public String add() {
        return "ApiTest/caseAdd";
    }

    @Override
    @RequestMapping("/apiManage")
    public String Server() {
        return "ApiTest/Servermanage";
    }



    @Override
    @RequestMapping("/audit")
    public String auditplate(){
        return "ApiTest/audit";
    }
}
